t = codesters.Teacher()
translations = t.find_text('translate')
reflect = t.find_text('reflect')
rotate = t.find_text('rotate')
try:
tval1 = translations[0][1]
except:
tval1 = "DNE"
try:
tval2 = translations[1][1]
except:
tval2 = "DNE"
try:
tval3 = sprite.get_x()
tval4 = sprite.get_y()
except:
tval3 = "DNE"
tval4 = "DNE"
try:
tval5 = len(reflect)
except:
tval5 = "DNE"
try:
tval6 = len(rotate)
except:
tval6 = "DNE"
t1 = TestObjective()
t1.add_success(('x' in tval1 or 'y' in tval1) and ('x' in tval2 or 'y' in tval2) and tval3 == 100 and tval4 == 100 and tval5 == 0 and tval6 == 0, "Great job!")
t1.add_failure(tval1 == "DNE" and tval2 == "DNE", "Try a Geometry Transformation command that maps your sprite to the target!")
t1.add_failure(('x' in tval1 or 'y' in tval1) and tval2 == "DNE", "You may need to use more than one translation command!")
t1.add_failure('x' not in tval1 and 'x' not in tval2, "Use Translate X to move your triangle sideways.")
t1.add_failure('y' not in tval1 and 'y' not in tval2, "Use Translate Y to move your triangle up or down.")
t1.add_failure(tval3 != 100 or tval4 != 100 and tval5 == 0 and tval6 == 0, "Those are the right commands! Adjust the numbers to map your triangle onto the target!")
t2 = TestObjective()
t2.add_failure(tval5 != 0, "Reflections flip shapes over a line. Try a different transformation!")
t2.add_failure(tval6 != 0, "Rotations turn shapes around a point Try a different transformation!")
if tval3 == 100 and tval4 == 100:
text.set_text(' ')
tester = TestManager()
tester.display_graphics = False
tester.add_test_list([t2,t1])
tester.run_tests()
tester.display_first_feedback()
Are you already running a Codesters project in another tab or window?
Micro:bit can only connect to one web page at a time.
Try stopping other Codesters projects or closing
other tabs or windows that may be using your Micro:bit.
If that doesn't fix the problem try disconnecting your Micro:bit,
reloading this page, and reconnecting your Micro:bit.